#!/usr/bin/env python
# coding=utf-8
import base58
from itertools import repeat

b58_str = input("Enter original string: ").encode('utf-8')
decode_times = int(input("Enter the number of times to decode: "))

for i in repeat(None, decode_times):
    b58_str = base58.b58decode(b58_str)

print(b58_str)
